var windowWith,windowHeight;
var contanierW;
var morenC;
;(function($){
	$(function(){
//		document.oncontextmenu=new Function("event.returnValue=false"); 
//		document.onselectstart=new Function("event.returnValue=false");
		
		getWindowSize();
		//头部search效果
		/*$(".searchDiv").on('click',function(){
			$(".searchDiv input").animate({'width':'140px'},300);
			$(".topnav .searchDiv i").addClass('glyphicon-red');
		});*/
		
		//2017/08/08
		$(".anlitab li").mouseenter(function(){
			$(this).addClass("addcurrent").siblings().removeClass("addcurrent");
			$(".anlicon li").eq($(this).index()).addClass("addcurrent").siblings().removeClass("addcurrent");
		})
		
		//手机端点击搜索按钮
		$(".mobi_nav_default .searchBtn").on('click',function(){
			if($(this).hasClass('current')){
				$(this).removeClass('current');
				$(".mobi_search_con").fadeOut(300);
			}else{
				$(this).addClass('current');
				$(".mobi_search_con").fadeIn(300);
			}
		});
		
		//点击手机导航效果
		$(".mobi_navBar").on('click',function(){
			if(!$(this).hasClass('current')){
				$(this).addClass('current');
				$(".navfixmask").fadeIn(400);
				$(".bodyMain").animate({'left':'-210px'},400);
				$(".mobi_navfixed").show().animate({'right':'0'},400);	
			}
			
		});
		
		$(".navfixmask").on('click',function(){
			$('.mobi_navBar').removeClass('current');
			$(".navfixmask").fadeOut(400);
			$(".bodyMain").animate({'left':'0'},400);
			$(".mobi_navfixed").animate({'right':'-210px'},400,function(){
				$(".mobi_navfixed").hide();
			});
		});
		
		$(".iglys").on('click',function(){
			if($(this).find(".glysamei").hasClass('current')){
				$(this).find(".glysamei").removeClass('current');
				$(this).find(".glysamei").closest('.same').siblings('div').fadeOut(400);
			}else{
				$(this).find(".glysamei").addClass('current');
				$(this).find(".glysamei").closest('.same').siblings('div').fadeIn(400);
			}
		});
		
		//PC端金融，政府，农业等五块效果
		 morenC = getfivemodule(170,385);
		TweenMax.to(".five-info-con ul li",0,{width:'14.66666666%'});
		TweenMax.to(".five-info-con ul li .opcityandPic",0.,{marginTop:morenC[1],height:morenC[0]});
		TweenMax.to(".five-info-con ul li.current",0,{width:'26.33333333%'});
		TweenMax.to(".five-info-con ul li.current .opcityandPic",0,{marginTop:morenC[3],height:morenC[2]});
		$(".five-info-con ul li").hover(function(){
			$(".five-info-con ul li").removeClass('current');
			$(this).addClass('current');
			TweenMax.to(".five-info-con ul li",0.3,{width:'14.6666666%'});
			TweenMax.to(".five-info-con ul li .opcityandPic",0.3,{marginTop:morenC[1],height:morenC[0]});
			TweenMax.to(".five-info-con ul li.current",0.3,{width:'26.33333333%'});
			TweenMax.to(".five-info-con ul li.current .opcityandPic",0.3,{marginTop:morenC[3],height:morenC[2]});
		},function(){
			
		});
		
		//底部友情链接
		$(".otherLink").on('click',function(){
			if($(this).hasClass('current')){
				$(this).removeClass('current');
				$(".otherlinkCon").fadeOut(300);
			}else{
				$(this).addClass('current');
				$(".otherlinkCon").fadeIn(300);
			}
		});
		
		
		$(".otherLink").hover(function(){
			$(".otherlinkCon").fadeIn(300);
		},function(){
			$(".otherlinkCon").fadeOut(300);
		});
		
		//mobi底部二维码
		$(".mobi-code").on('click',function(){
			$(".erweimaPop").fadeIn(300);
		});
		$(".erweimaPop .mask").on('click',function(){
			$(".erweimaPop").fadeOut(300);
		});
		
		//mobi投资者 定期报告
		$(".reports_re .re_d").on('click',function(){
			$(this).find('.inneropcity').fadeIn(200);
		});
		
		//tabs($(".container_tab_company .tab_title_company ul li a"), $('.tab_con_company .con_con'));  
		//tabs($(".container_tabjl .tab_title_jl ul li a"), $('.tab_con_jl .tzzjl'));
		
		//公司简介tab切换
		tabs($(".about-intro-con .title ul li"), $('.aobutTabcon .conSame')); 
		
		//农业云图片点击放大弹框
		
		/*$(".btnBigpic").on('click',function(){
			$('.bigImgPop').fadeIn(300);
			var indsrc = $(this).attr('data-src');
			$('.bigImgPop .img img').attr('src',indsrc);
			$('.bigImgPop .img innerPic').attr('href',indsrc);
		});*/
		$(".bigImgPop .opacity").on('click',function(){
			$('.bigImgPop').fadeOut(300);
		});
		
		
		$(window).resize(function(){
			getWindowSize();
			morenC = getfivemodule(170,385);
			//当改变窗口大于768，取消小屏原有操作
			if(windowWith>768){
				$(".bodyMain").css({'left':0});
				$(".mobi_navfixed").fadeOut(0,function(){
					$(".mobi_navfixed").css({'right':'-210px'});
					$(".navfixmask").fadeOut(0);
				});
				$(".mobi_nav_default a").removeClass('current');
			}
		});
		
		//开放职业页面tab选项卡
                $(".recruit_center .recruitHr_form_tit").eq(0).find(".recruitHr_form_tit2").addClass("active");
                $(".recruit_center .recruitHr_form_center").eq(0).removeClass("hide");
		$(".recruitHr_form_tit").on('click',function(){
			if($(this).find(".recruitHr_form_tit2").hasClass("active")){
				$(this).find(".recruitHr_form_tit2").removeClass("active");
				$(this).next(".recruitHr_form_center").addClass("hide");
			}else{
				$(this).find(".recruitHr_form_tit2").addClass("active");
				$(this).next(".recruitHr_form_center").removeClass("hide");
			}
		
		});
	
		//选项卡划过改变
		$('.cio_chanpin_word').mouseover(function(){
			$('.cio_chanpin_word').attr('src','/statics/images/dcits/cio/cio_chanpin_wordhover.png');
		});
		$('.cio_chanpin_word').mouseout(function(){
			$('.cio_chanpin_word').attr('src','/statics/images/dcits/cio/cio_chanpin_word.png');
		});
		$('.cio_chanpin_question').mouseover(function(){
			$('.cio_chanpin_question').attr('src','/statics/images/dcits/cio/cio_chanpin_questionhover.png');
		});
		$('.cio_chanpin_question').mouseout(function(){
			$('.cio_chanpin_question').attr('src','/statics/images/dcits/cio/cio_chanpin_question.png');
		});
		/*$('.cio_chanpin_tel').mouseover(function(){
			$('.cio_chanpin_tel').attr('src','/statics/images/dcits/cio/cio_chanpin_telhover.png');
		});
		$('.cio_chanpin_tel').mouseout(function(){
			$('.cio_chanpin_tel').attr('src','/statics/images/dcits/cio/cio_chanpin_tel.png');
		});*/
		$('.cio_chanpin_tel').mouseover(function(){
			$('.cio_chanpin_tel').attr('src','/statics/images/dcits/cio/cio_chanpin_videohover.png');
		});
		$('.cio_chanpin_tel').mouseout(function(){
			$('.cio_chanpin_tel').attr('src','/statics/images/dcits/cio/cio_chanpin_video.png');
		});

		//时间轴
		var ProductYearWidth =$('.Product_years_logo') * $('.Product_years_all').find('li').length;
		$('.Product_years_all').css('width',ProductYearWidth+'px');
		
		
		$(".xzsyTabBox .tab li:last-child").addClass("noline");
		
		$(".tishiBoxLayer .close").on('click',function(){
			$('.tishiBoxLayer .tsContent .cont span').html('');
			$('.tishiBoxLayer').fadeOut(300);
		});
		
		if($(".consult_inner .row-link-same:eq(0)").text()==0){
			//console.log($(this));
			$(".consult_inner .row-link-same:eq(0)").remove();
			$(".consult_inner").addClass("consult_innerTwo");
			
		}
		
		
		
		
		/*$(".Animate .row .col-xs-6").mouseenter(function(){
			$(this).find(".pic").addClass("animatedtw flipInY");
		})
		$(".Animate .row .col-xs-6").mouseleave(function(){
			$(this).find(".pic").removeClass("animatedtw flipInY");
		})*/
		
		
		
		
		
	})
	
	
})(jQuery);

function getWindowSize(){
	 windowWith = $(window).width();
	 windowHeight = $(window).height();
	 contanierW =$(".container").width();
}

//首页金融，农业等动画函数
function getfivemodule(picW,picH){
	var height = picH*contanierW*0.16666666/picW;
	var cur_height = picH*contanierW*0.3333333333/picW;
	var marginTop = -height/2;
	var marginTop_cur = -cur_height/2;
	return [height,marginTop,cur_height,marginTop_cur];
}


var tabs = function(tab, con){
    tab.click(function(){ var indx = tab.index(this);
        tab.removeClass('current');
        $(this).addClass('current');
        con.hide();
        con.eq(indx).show();
    })    
}

//典型客户切换
/* 
 * changebox 大框
 * marginRight li对应的margin-right
 * wid 每个li的宽度与margin-right的宽度和
 * */
var dxchangetab = function(changebox,marginRight){
	var $changeboxLi = changebox.find('li');
	var $changechild = changebox.children('.changebox-custom');
	var $changeUl = changebox.find('ul');
	var $next = changebox.find('next');
	var $pre = changebox.find('prev');
	var liwidth = $changeboxLi.width()+marginRight;
	var num = 0;
	var staute = true;
	$changeUl.width($changeboxLi.width()*$changeUl.find('li').length+$changeUl.find('li').length*marginRight)
	
	$(changebox).on('click','.next',function(){
		if(staute){
			staute = false;
			if($changechild.width()/liwidth >= $changeboxLi.length-num){num = num;}
			else{
				num++;
				$changeUl.animate({'left':-(liwidth*num)+'px'},200,function(){
					staute =true;
				});
			}
		}
		
	});

	$(changebox).on('click','.prev',function(){
		if(staute){
			staute = false;
			if(num <= 0){num = 0;}
			else{
				num--;
				$changeUl.animate({'left':-(liwidth*num)+'px'},200,function(){
					staute =true;
				});
			}
		}
		
		
	});
}


;(function($){
	$(function(){
		var $newsYears = $(".news_years").find('li');
		var news_select = $(".news_years_select");
		var newsYearsUlw1 = $('.news_years ul li').width()+6;
		var num = 0;
		var w = document.body.offsetWidth;
		var bodyHeight = $(window).height();
		var mainHeight = $(".bodyMain").height();
		var otherHeight = $('.topwarpnav').height()+$('#footer').height();
		if(bodyHeight>=mainHeight){
			console.log(bodyHeight,otherHeight)
			$(".mainwrap").css('min-height',(bodyHeight-otherHeight)+'px');

		}
		function innerTime(){

			$('.solution_txt11').height($('.solution_txt21').height());
			$('.solution_txt12').height($('.solution_txt22').height());
			$('.solution_txt13').height($('.solution_txt23').height());
			$('.solution_txt24').height($('.solution_txt14').height());
			$('.solution_txt25').height($('.solution_txt15').height());
		}
		innerTime = setInterval(innerTime,10);

		$('.news_years ul').width($('.news_years ul li').width()*$('.news_years').find('li').length+$('.news_years').find('li').length*6)
		$newsYears.on('click',function(){
			$(this).addClass("news_years_select").siblings().removeClass("news_years_select");
		});
		$('.news_years_right').on('click',function(){
			if($('.news_years').width()/116 >= $newsYears.length-num){num = num;}
			else{
				num++;
				$('.news_years ul').css('left',-(newsYearsUlw1*num)+'px');
			}
			
		});

		$('.news_years_left').on('click',function(){
			if(num <= 0){num = 0;}
			else{
				num--;
				$('.news_years ul').css('left',-(newsYearsUlw1*num)+'px');
			}
			
		});



		//时间轴
		var $ProductYears = $(".Product_years_all").find('li');
		var ProductsNum = 0;
		var ProductsYearsUlw1 = $('.Product_years_all li').width();
		var productsSize = $ProductYears.size();
		
		function windowWidth(){
			if($(window).width()<1000){
				$('.Product_years').width($(window).width()-80);
				$('.Product_years_line').width($('.Product_years').width()-108);
			}else{
				$('.Product_years').width(864);
				$('.Product_years_line').width(756);
			}

			var soffset = $('.Product_years_select').offset();
			if(soffset){
				if(soffset.left > $('.Product_years').width()+$('.Product_years').offset().left){
					ProductsNum = $('.Product_years_all li').index($('.Product_years_select'));
					$('.Product_years ul').css('left',-(ProductsYearsUlw1*ProductsNum)+'px');
					$('.Product_years_arrow').css('left','38px')
				}
			}
		};
		//setInterval(windowWidth,10)
		window.onresize = windowWidth;
		windowWidth();
		$('.Product_years_all').width($('.Product_years_all li').width()*$('.Product_years_all').find('li').length)
		$ProductYears.on('click',function(){
			$(this).addClass("Product_years_select").siblings().removeClass("Product_years_select");
			var c = $('.Product_years_all li').index($('.Product_years_select'));
			$('.Product_years_tab_txt').css('display','none');
			$('.Product_years_tab'+(c+1)).css('display','inline-table');
			change();
			ProductsNum = c;
		});
		$('.Product_years_right').on('click',function(){

			if( ProductsNum === productsSize -1){
				return;
			}
			ProductsNum++;
			var soffset = $('.Product_years_select').offset();
			if(soffset.left + 150 > $('.Product_years').width()+$('.Product_years').offset().left){
				var _left = parseInt($('.Product_years ul').css('left'));
				if(isNaN(_left)){
					_left = 0;
				}
				$('.Product_years ul').css('left', (_left-108)+'px');
			}
			var currentProduct = $(".Product_years_all .Product_years_select");
			$(currentProduct).removeClass('Product_years_select');
			$(currentProduct).next().addClass("Product_years_select");
			change();
			var c = $('.Product_years_all li').index($('.Product_years_select'));
			$('.Product_years_tab_txt').css('display','none');
			$('.Product_years_tab'+(c+1)).css('display','inline-table');
		});

		$('.Product_years_left').on('click',function(){
			if(ProductsNum === 0){
				return;
			}
			ProductsNum--;
			if($('.Product_years_select').offset().left -100 < $('.Product_years').offset().left){
				var _left = parseInt($('.Product_years ul').css('left'));
				if(isNaN(_left)){
					_left = 0;
				}
				$('.Product_years ul').css('left', (_left+108)+'px');
			}
			//$('.Product_years ul').css('left',-(ProductsYearsUlw1*ProductsNum)+'px');
			var currentProduct = $(".Product_years_all .Product_years_select");
			$(currentProduct).removeClass('Product_years_select');
			$(currentProduct).prev().addClass("Product_years_select");
			change();
			var c = $('.Product_years_all li').index($('.Product_years_select'));
			$('.Product_years_tab_txt').css('display','none');
			$('.Product_years_tab'+(c+1)).css('display','inline-table');
		});
		function change(){
			$('.Product_years_img').attr('src','/statics/images/dcits/cio/cio_logo1.png');
			$('.Product_years_select').find('.Product_years_img').attr('src','/statics/images/dcits/cio/cio_logo2.png');
			change2();
		}
		function change2(){
			var a = $('.Product_years_select');
			var soffset = $('.Product_years_select').offset();
			var coffset = $('.Product_years_center').offset();
			/*var right = offset.left + a.width();
				right = parseInt(right / 108)-5;
				if($(window).width()<1900){
					right = right;
				}
			if(right<0){right=0;}
			if(right>7){right=7;}
			$('.Product_years_arrow').css('left',(38+108*right)+'px');*/
			$('.Product_years_arrow').css('left',(soffset.left - coffset.left + 38) +'px')
		}
		
		//change();

		$('.return_top').on('click',function(){
			$('body,html').animate({scrollTop:0},1000);
		});
		$('#big_txt').on('click',function(){
			$(".myPrintArea").find('p').css('font-size','16px');
			$('.news_txt').find('span').css('font-size','14px');
			$('#big_txt').css('font-size','16px');
		});
		$('#mid_txt').on('click',function(){
			$(".myPrintArea").find('p').css('font-size','14px');
			$('.news_txt').find('span').css('font-size','14px');
			$('#mid_txt').css('font-size','16px');
			
		});
		$('#small_txt').on('click',function(){
			$(".myPrintArea").find('p').css('font-size','12px');
			$('.news_txt').find('span').css('font-size','14px');
			$('#small_txt').css('font-size','16px');
		});
		$("#news_push").on('click',function(){
			bdhtml=window.document.body.innerHTML;    
	        sprnstr="<!--startprint-->";    
	        eprnstr="<!--endprint-->";    
	        prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+17);
	        prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));    
	        window.document.body.innerHTML=prnhtml;    
	        window.print();
		})
		
		


	})
	
})(jQuery);